package cn.sstir.hackathon.core.initialization;


import cn.sstir.hackathon.config.properties.CountryProperties;
import cn.sstir.hackathon.core.dict.CountryDict;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author: fli
 * @email: fli@sstir.cn
 * @date: 2019/12/31 14:14
 */
@Component
@Slf4j
public class CountryDictRunner implements CommandLineRunner {

    private final CountryProperties countryProperties;

    @Autowired
    public CountryDictRunner(CountryProperties countryProperties) {
        this.countryProperties = countryProperties;
    }

    @Override
    public void run(String... args) {
        CountryDict.COUNTRY_MAP.putAll(countryProperties.getMap());
        log.info("******国籍字典加载完成******");
    }
}
